const arr = [1, 2, 3]; Array.prototype.myPush = function() { const { length } = arguments; for (let i = 0; i < length; i++) { this[this.length] = arguments[i]; } return this.length; } arr.myPush(4,5,6); console.log(arr); // [1, 2, 3, 4, 5, 6]
← Vue3 魔改G6 imageMinimap →